import axios from "../config"

/**
 * 获取文件列表
 * @returns {Promise<unknown>}
 */
export const getFileList = data => {
  return axios({
    url: "/oss/getFileList",
    method: "post",
    data
  })
}

/**
 * 获取文件夹列表
 * @returns {Promise<unknown>}
 */
export const getDirList = data => {
  return axios({
    url: "/oss/getDirList",
    method: "post",
    data
  })
}
/**
 * 预览文件
 * @returns {Promise<unknown>}
 */
export const previewFile = data => {
  return axios({
    url: "/oss/previewFile",
    method: "post",
    data
  })
}

/**
 * 删除下载文件
 * @returns {Promise<unknown>}
 */
export const deleteFile_ = data => {
  return axios({
    url: "/oss/deleteFile_",
    method: "post",
    data
  })
}

/**
 * 重命名文件
 * @returns {Promise<unknown>}
 */
export const reNameFile = data => {
  return axios({
    url: "/oss/reNameFile",
    method: "post",
    data
  })
}

/**
 * 新建文件夹
 * @returns {Promise<unknown>}
 */
export const mkDir = data => {
  return axios({
    url: "/oss/mkDir",
    method: "post",
    data
  })
}

export const downloadFile = data => {
  return axios({
    url: "/oss/downloadFile",
    method: "get",
    params: data
  });
};

